/*
 * @(#)SynObjectKey.java   1.0  2021年11月17日
 * 
 * Copyright (c)	2014-2020. All Rights Reserved.	GuangZhou hhmk Technology Company LTD.
 */
package com.swift.dts.dao.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.swift.core.model.data.AbstractBeanDataModel;

/**
 * 添加说明
 * 
 * @author zhengjiajin
 * @version 1.0 2021年11月17日
 */
public class SynObjectKey extends AbstractBeanDataModel {

    @JsonProperty("destination")
    private String destination;

    @JsonProperty("data_source")
    private String dataSource;

    @JsonProperty("db_name")
    private String dbName;

    @JsonProperty("table_name")
    private String tableName;

    /**
     * @return the destination
     */
    public String getDestination() {
        return destination;
    }

    /**
     * @param destination
     *            the destination to set
     */
    public void setDestination(String destination) {
        this.destination = destination;
    }

    /**
     * @return the dataSource
     */
    public String getDataSource() {
        return dataSource;
    }

    /**
     * @param dataSource
     *            the dataSource to set
     */
    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    /**
     * @return the dbName
     */
    public String getDbName() {
        return dbName;
    }

    /**
     * @param dbName
     *            the dbName to set
     */
    public void setDbName(String dbName) {
        this.dbName = dbName;
    }

    /**
     * @return the tableName
     */
    public String getTableName() {
        return tableName;
    }

    /**
     * @param tableName
     *            the tableName to set
     */
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    @Override
    public String toString() {
        return this.dataSource + "." + this.destination + "." + this.dbName + "." + this.tableName;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;// 地址相等
        }
        if (obj == null) {
            return false;// 非空性：对于任意非空引用x，x.equals(null)应该返回false。
        }
        if (obj instanceof SynObjectKey) {
            // 需要比较的字段相等，则这两个对象相等
            if (this.toString().equals(obj.toString())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        return this.toString().hashCode();
    }

}
